package com.hly.versioncontroladmin.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hly.versioncontroladmin.domain.Bo.VcApplicationBo;
import com.hly.versioncontroladmin.domain.Bo.VcDownloadLogBo;
import com.hly.versioncontroladmin.domain.VcApplication;
import com.hly.versioncontroladmin.domain.VcDownloadLog;
import com.hly.versioncontroladmin.mapper.VcDownloadLogMapper;
import com.hly.versioncontroladmin.result.PageQuery;
import com.hly.versioncontroladmin.service.VcDownloadLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class VcDownloadLogServiceImpl extends ServiceImpl<VcDownloadLogMapper, VcDownloadLog> implements VcDownloadLogService {

    @Override
    public Page<VcDownloadLog> listQuery(PageQuery<VcDownloadLog> pageQuery, VcDownloadLogBo bo) {
        Page<VcDownloadLog> page = buildQueryWrapper(bo).page(pageQuery.builderPage());
        return page;
    }

    public LambdaQueryChainWrapper<VcDownloadLog> buildQueryWrapper(VcDownloadLogBo bo){
        LambdaQueryChainWrapper<VcDownloadLog> queryChainWrapper = lambdaQuery()
                .like(bo.getInfo() != null, VcDownloadLog::getInfo, bo.getInfo());
        return queryChainWrapper;
    }

}
